package com.ms.banner.transformer;

import ohos.agp.components.Component;

public class ZoomOutTransformer extends ABaseTransformer {
    @Override
    protected void onTransform(Component component, float position) {
        float scale = 1.0F + Math.abs(position);
        component.setScaleX(scale);
        component.setScaleY(scale);
        component.setPivotX((float)component.getWidth() * 0.5F);
        component.setPivotY((float)component.getHeight() * 0.5F);
        component.setAlpha(position >= -1.0F || position <= 1.0F ? 1.0F - (scale - 1.0F) : 0.0F);
        if (position == -1.0F) {
            component.setTranslationX((float)(component.getWidth() * -1));
        }
    }
}
